﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Mvc;

namespace Quizz.Infrastructure
{
    public sealed class Constants
    {
        // User and account
        public const string USER_LOGINED = "UserLogined";

        // Role id
        public const long ADMIN_ROLE_ID = 0;
        public const long EDITOR_ROLE_ID = 1;
        public const long USER_ROLE_ID = 2;

        public const long ROOT_ADMIN_ID = 0;

        // Links
        public const string HomePageLink = "/Home/Index";
        public const string AccountInfoLink = "/Account/Info/";

        // Others
        public const string MAIN_MENU = "MainMenu";

        // Regular Expression
        public const string PasswordRegex = @"^.{6,}(?<=\d.*)(?<=[^a-zA-Z0-9].*)$";

        #region Pages

        private static RedirectToRouteResult _homePage;

        public static RedirectToRouteResult HomePage
        {
            get
            {
                if(_homePage == null)
                {
                    var dictionary = new Dictionary<string, object> {{"action", "Index"}, {"controller", "Home"}};
                    return _homePage = new RedirectToRouteResult(new System.Web.Routing.RouteValueDictionary(dictionary));
                }
                return _homePage;
            }
        }

        #endregion

        // Menu
        public const int MenuHome = 0;
        public const int MenuManage = 1;

        // Keys
        public const string LastLoginLog = "LastLoginLog";
        public const string UserListCurrent = "UserListCurrent";
        public const string UserListOrder = "UserListOrder";
        public const string UserListKeyWord = "UserListKeyWord";

        public const string QuestionListCurrent = "QuestionListCurrent";
        public const string QuestionListOrder = "QuestionListOrder";
        public const string QuestionListKeyword = "QuestionListKeyword";

        // Question
        public const string CurrentWorkingQuestion = "CurrentWorkingQuestion";
    }
}
